// compontents/likes/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    like: {
      type: Boolean,
      value: false
    },
    count: {
      type: Number,
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    yesSrc: 'images/like.png',
    noSrc: 'images/like@dis.png'
  },

  /**
   * 组件的方法列表s
   */
  methods: {
    onLike: function(){
      let like = this.properties.like
      let count = this.properties.count
      count = like?count-1:count+1 
      this.setData({
        like: !like,
        count: count
      })
      let likeState = this.properties.like
      this.triggerEvent('like',{
        likeState: likeState
      })
    }
  }
})
